package com.gxc.datacore.db.dialect.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.gxc.datacore.db.dialect.Dialect;
import com.gxc.dbcore.dao.SqlDao;

public class MySqlDialectImpl implements Dialect {

	public String buildJdbcURL(String host, String port, String database) {
		return "jdbc:mysql://" + host.trim() + ":" + port.trim() + "/"
				+ database.trim();
	}

	@SuppressWarnings("rawtypes")
	public List listTables(SqlDao sqlDao) {
		List list = sqlDao.selectList("dialect.mysql.listTables");
		return list;
	}

	@SuppressWarnings({ "unchecked", "rawtypes" })
	public List listColumns(SqlDao sqlDao, String schema_name, String table_name) {
		Map params = new HashMap();
		params.put("schema_name", schema_name);
		params.put("table_name", table_name);
		return sqlDao.selectList("dialect.mysql.listColumns", params);
	}

}
